package com.nhn.ssi.client;

import java.io.IOException;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.nhn.ssi.bean.Product;
import com.nhn.ssi.dao.TestDao;
import com.nhn.ssi.util.FilePathUtil;
import com.nhn.ssi.util.FileUtil;

public class ClientUtil {

	private static BeanFactory factory = new ClassPathXmlApplicationContext("applicationContext-*.xml");
	private static TestDao testDao = (TestDao)factory.getBean("testDao");
	private static Map<String, Object> paramMap = new HashMap<String, Object>();

	public static List<Product> getProductList() throws IOException {
		List<Product> list = null;
		try {
			list = testDao.selectProductList(paramMap);
		} catch (SQLException e) {
			e.printStackTrace();
			FileUtil.writeTxtFile("getProductList;" + e.toString(), FilePathUtil.ERROR_LOG_FILE);
		}
		return list;

	}

}
